﻿using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace Code.CharacterSystem
{
    public class PlayerHUD:MonoBehaviour
    {
        private Transform cam;
        [SerializeField] private HealthBar _healthBar;
        [SerializeField] private Text _playerText;

        private void Start()
        {
            cam = Camera.main.transform;
        }

        private void Update()
        {
            transform.LookAt(transform.position+cam.forward);
        }

        public void SetMaxHealth(int health) 
        {
            _healthBar.SetMaxHealth(health);
        }
        public void SetHealth(int health) 
        {
            _healthBar.SetHealth(health);
        }

        public void SetName(string name) 
        {
            _playerText.text = name;
        }

        public void SetNameColor(Color color) 
        {
            _playerText.color = color;
        }
    
    }
}
